package com.yaowk.authc.plugin;

import com.jfinal.kit.PathKit;
import com.jfinal.plugin.IPlugin;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.yaowk.authc.model._MappingKit;

/**
 * Created by yaowk on 2017/4/17.
 */
public class AuthcPlugin implements IPlugin {

    private ActiveRecordPlugin arp;

    public AuthcPlugin(ActiveRecordPlugin arp) {
        this.arp = arp;
    }

    @Override
    public boolean start() {
        // 配置数据库操作资源
        arp.setBaseSqlTemplatePath(PathKit.getRootClassPath());
        arp.addSqlTemplate("authc.template");
        _MappingKit.mapping(arp);
        arp.setShowSql(true);
        return true;
    }

    @Override
    public boolean stop() {
        return false;
    }
}
